<?php
error_reporting(E_ALL);

function return_direct($boolean = null)
{
    if ($boolean)
    {
		echo "echoapple";
		return 'apple';
    }
	echo "echopie";
    return 'pie';
}

echo return_direct(11) . "<br />";

define("apple","how to access variables outside classes<br />");

class Test {
	//global $apple;
	function echoapple() {
		echo apple;
	}
}

$t = new Test();
$t->echoapple();


print_r(PDO::getAvailableDrivers());
echo "<br />";

try {
    $dbh = new PDO('mysql:host=localhost;dbname=productshowcasephp_development', "php", "php123", array(PDO::ATTR_PERSISTENT => true));
	$sth = $dbh->prepare('SELECT *
    FROM users');
    //WHERE id = ?');
	//$sth->execute(array(1));
	$sth->execute();
	
	$result = $sth->fetch(PDO::FETCH_LAZY);
	echo $result['f_name'];
	print_r($result);
/*
    foreach($dbh->query('SELECT * from users') as $row) {
        print_r($row);
		echo "<br />";
		echo $row['f_name'];
		echo "<br />";
    }
*/
    $dbh = null;
} catch (PDOException $e) {
    print "Error!: " . $e->getMessage() . "<br/>";
    die();
}



?>